<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改专家消息')"/>
    <th:block th:include="include :: select2-css"/>
    <!--文件上传-->
    <link th:href="@{/layui-v2.5.4/css/layui.css}" rel="stylesheet"/>
    <style type="text/css">
        .uploader-list {
            margin-left: -15px;
        }

        .uploader-list .info {
            position: relative;
            margin-top: -25px;
            background-color: black;
            color: white;
            filter: alpha(Opacity=80);
            -moz-opacity: 0.5;
            opacity: 0.5;
            width: 100px;
            height: 25px;
            text-align: center;
            display: none;
        }

        .uploader-list .handle {
            position: relative;
            background-color: black;
            color: white;
            filter: alpha(Opacity=80);
            -moz-opacity: 0.5;
            opacity: 0.5;
            width: 100px;
            text-align: right;
            height: 18px;
            margin-bottom: -18px;
            display: none;
        }

        .uploader-list .handle i {
            margin-right: 5px;
        }

        .uploader-list .handle i:hover {
            cursor: pointer;
        }

        .uploader-list .file-iteme {
            margin: 12px 0 0 15px;
            padding: 1px;
            float: left;
        }
    </style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-info-edit" th:object="${expertInfo}">
        <input name="expertId" th:field="*{expertId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">会员名称：</label>
            <div class="col-sm-8">
                <!-- <input name="memberId" th:field="*{memberId}" class="form-control" type="text">-->
                <select id="memberId" disabled="disabled" name="memberId" class="form-control"
                        th:with="memberInfoList=${@memberInfo.selectMemberInfoListForqd()}" th:field="*{memberId}">
                    <option th:each="memberinfo : ${memberInfoList}" th:text="${memberinfo.nikeName}"
                            th:value="${memberinfo.memberId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">个人照片：</label>
            <div class="col-sm-8">
                <!-- <input name="personalPhoto" th:field="*{personalPhoto}" class="form-control" type="text">-->
                <div class="layui-upload">
                    <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;width: 100%">
                        <div class="layui-upload-list uploader-list" style="overflow: auto;" id="uploader-list">

                        </div>
                    </blockquote>
                </div>
                <input id="personalPhoto" name="personalPhoto" type="hidden">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">真实姓名：</label>
            <div class="col-sm-8">
                <input name="realName" disabled="disabled" th:field="*{realName}" class="form-control" type="text"
                       required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">手机号：</label>
            <div class="col-sm-8">
                <input name="phone" disabled="disabled" th:field="*{phone}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">邮箱：</label>
            <div class="col-sm-8">
                <input name="email" disabled="disabled" th:field="*{email}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">所在地编码：</label>
            <div class="col-sm-8">
                <input name="areaCode" disabled="disabled" th:field="*{areaCode}" class="form-control" type="text"
                       required>
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label is-required">擅长专业作物编码：</label>
            <div class="col-sm-8">
                <input name="cropCode" th:field="*{cropCode}" class="form-control" type="text" required>
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">擅长作物编码：</label>
            <div class="col-sm-8">
                <select name="cropCode" disabled="disabled" id="cropCode" class="form-control select2-multiple" multiple
                        th:with="cropDictList=${@cropdict.selectCropDictByPartant(1)}">
                    <option th:each="cropdicta : ${cropDictList}" th:text="${cropdicta.cropName}"
                            th:value="${cropdicta.cropId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">擅长领域编码：</label>
            <div class="col-sm-8">
                <select name="regionCode" disabled="disabled" id="regionCode" class="form-control select2-multiple"
                        multiple th:with="cropDictList=${@cropdict.selectCropDictByPartant(0)}">
                    <option th:each="cropdicta : ${cropDictList}" th:text="${cropdicta.cropName}"
                            th:value="${cropdicta.cropId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">身份证号码：</label>
            <div class="col-sm-8">
                <textarea name="idenCard" disabled="disabled" th:field="*{idenCard}" class="form-control"
                          type="text"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">个人简介：</label>
            <div class="col-sm-8">
                <textarea name="personalProfile" disabled="disabled" th:field="*{personalProfile}" class="form-control"
                          type="text"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">审核状态：</label>
            <div class="col-sm-8">
                <select name="verifyStatus" id="verifyStatus" class="form-control">
                    <option value="1">审核通过</option>
                    <option value="2">审核失败</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">所属系统：</label>
            <div class="col-sm-8">
                <input name="sysName" disabled="disabled" th:field="*{sysName}" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>


<div class="row">
    <div class="col-sm-offset-5 col-sm-10">
        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存
        </button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭
        </button>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript" th:inline="javascript">
    var ctx = [[${#request.getContextPath()}]];
    var questionImages = "";

    var prefix = ctx + "/agriculture/info";
    $("#form-info-edit").validate({
        focusCleanup: true
    });

    /*select2下拉多选回显*/
    var arr = [[${expertInfo.cropCode}]];
    $("#cropCode").val(arr.split(",")).trigger("change");

    var arr2 = [[${expertInfo.regionCode}]];
    $("#regionCode").val(arr2.split(",")).trigger("change");

    var picturesString = [[${expertInfo.personalPhoto}]];
    console.log(picturesString)
    if (picturesString != null) {
        $('#uploader-list').append(
            '<div id="" class="file-iteme">' +
            '<div class="handle"><i class="layui-icon layui-icon-delete"></i></div>' +
            '<img style="width: 100px;height: 100px;" src=' + picturesString + '>' +
            '</div>'
        );
    }

    function submitHandler() {
        console.log("submitHandler");
        if ($.validate.form()) {
            $.operate.save(prefix + "/audit", $('#form-info-edit').serialize());
        }
    }
</script>
</body>
</html>